<%--
  Created by IntelliJ IDEA.
  User: 陈帅玺
  Date: 2019-02-16
  Time: 15:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<link rel="stylesheet" href="/assets/css/loader-style.css">
<link rel="stylesheet" href="/assets/css/bootstrap.css">
<link rel="stylesheet" href="/layui/css/layui.css">
<script src="/js/jquery-3.3.1.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/config.js"></script>
<link rel="shortcut icon" href="/assets/ico/minus.png">
<style>
    .box-pad {
        padding: 1%
    }
    #detail {
        display: none;
        padding: 30px 50px 0 50px;
    }
    #serviceForm input {
        border: none;
    }

</style>
<head>
    <title>服务查看</title>
</head>

<body>
<div id="detail">
    <form class="layui-form" id="serviceForm" lay-filter="serviceForm">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户</label>
                <div class="layui-input-inline">
                    <input type="text" name="clientele" id="fenpeiren" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">服务类型：</label>
                <div class="layui-inline">
                    <input type="text" name="serviceType" id="detailType" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">概要</label>
            <div class="layui-input-block">
                <input type="text" name="outline" id="gaiyao" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">服务请求</label>
            <div class="layui-input-block">
                <input type="text" name="serviceRequest" id="qingqiu" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">创建人</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="founderName" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">创建时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="creationTime" id="chuangjiantime" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">分配人</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="distriName" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">分配时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="distriTime" id="fenpeitime" class="layui-input" readonly>
                </div>
            </div>
        </div>
    </form>
</div>
<div class="box-pad">
    <h1>服务查看</h1>
    <hr>
    <form class="layui-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户名：</label>
                <div class="layui-inline">
                    <input type="text" id="clientele" class="layui-input" autocomplete="off">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">服务类型：</label>
                <div class="layui-inline">
                    <select id="serviceType" name="typeid" class="layui-select">
                        <option value="-1">请选择</option>
                        <c:forEach items="${crmDictionaries}" var="cd">
                            <option value="${cd.id}">${cd.name}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <button type="button" class="layui-btn" style="margin-bottom: 10px" onclick="searchData()">查询</button>
        </div>
    </form>
    <table class="layui-table" lay-data="{url:'/Service/chakanfuwu',page:true, id:'userTable',toolbar:'#toolbarDemo',defaultToolbar: ['filter', 'print', 'exports'],even: true}" lay-filter="userTable">
        <thead>
        <tr>
            <th lay-data="{field:'id', width:80, sort: true}">ID</th>
            <th lay-data="{field:'clientele', width:180}">用户名</th>
            <th lay-data="{templet:'#typeid'}">服务类型</th>
            <th lay-data="{field:'outline'}">概要</th>
            <th lay-data="{templet:'#user'}">创建人</th>
            <th lay-data="{field:'assignerTime'}">创建时间</th>
            <th lay-data="{toolbar:'#barDemo'}">操作</th>
        </tr>
        </thead>
    </table>

    <script>
        function searchData(){
            layui.table.reload("userTable",{
                page:{
                    curr : 1
                },
                where:{
                    "clientele":$("#clientele").val(),
                    "typeid" : $("#serviceType").val()
                }
            });
        }
        //  layui渲染
        var table;
        layui.use(['table','form'], function () {
            table = layui.table;
            var form = layui.form;
            table.on('tool(userTable)',function (obj) {
                var e = obj.event;
                var data=obj.data
                $("#fenpeiren").val(data.clientele);
                $("#detailType").val(data.dictionariesid.name);
                $("#gaiyao").val(data.outline);
                $("#qingqiu").val(data.request);
                $("#founderName").val(data.crmUser.username);
                $("#chuangjiantime").val(data.creatorTime);
                $("#fenpeitime").val(data.assignerTime);
                $("#distriName").val(data.fenpei.username);
                $("#handle").val(data.handle);
                $("#handleName").val(data.crmUser.username);
                $("#handleTime").val(data.conductorTime);
                $("#chulijieg").val(data.feedback);
                // $("#satisfied").val(data.manyidu.name);
                console.log(data)
                switch (e){
                    case "select":
                        layer.open({
                            type: 1,
                            title: "查看服务",
                            skin: "layui-layer-molv",
                            anim: 0,
                            // offset:'260px',
                            area: "900px",
                            content: $("#detail"),
                            btn: ['返回'],
                        })
                        break;
                }
            })
        })
    </script>
    <script type="text/html" id="typeid">
        {{d.dictionariesid.name}}
    </script>
    <script type="text/html" id="user">
        {{d.crmUser.username}}
    </script>
    <!--  分配、删除  -->
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs " lay-event="select" title="查看"><span class="layui-icon layui-icon-list"></span></a>
    </script>
</div>
</body>
</html>
